package com.primaryedu.ui;

import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.emagic.manage.data.entities.response.UserResponse;
import com.emagic.manage.modules.room.activity.RoomActivity;
import com.primaryedu.R;
import com.primaryedu.data.GlobalData;
import com.primaryedu.data.HigtApplication;

/**
 * Created by Thomas_yang on 2018/12/12.
 */

public class VideoCallActivity extends BaseAppCompatActivity implements OnClickListener{

    private ImageView iv_reject, iv_answer;
    private HigtApplication application;

    @Override
    protected int BindLayout() {
        return R.layout.activity_videocall;
    }

    @Override
    protected void initView() {
        application = (HigtApplication) this.getApplication();
        iv_reject = $(R.id.iv_reject);//拒绝
        iv_answer = $(R.id.iv_answer);//接听
        iv_reject.setOnClickListener(this);
        iv_answer.setOnClickListener(this);
    }

    @Override
    protected void initData() {

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.iv_reject://拒绝
                finish();
                break;
            case R.id.iv_answer://接听
                enterVideoCall();
                break;
        }
    }

    private void enterVideoCall() {
        UserResponse userResponse = new UserResponse();
        userResponse.setUserid(GlobalData.getUserId(this));
        userResponse.setUserroleid("2");//用户角色 0：主讲 1：助教 2: 学员 3：直播用户 4:巡检员　10:系统管理员　11:平台管理员　12:企业管理员 14:二级代理
        userResponse.setFirstname(GlobalData.getUserId(this));
        application.setCurrentUser(userResponse);
        if (GlobalData.getSerial(this) != null) {
            RoomActivity.toAction(this,
                    GlobalData.getSerial(this),
                    "",
                    "铁心桥小学",
                    "0");
            finish();
        }
    }
}
